﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace fap
{
    /// <summary>
    /// Page1.xaml 的交互逻辑
    /// </summary>
    public partial class 统计 : Page
    {
        public 统计()
        {
            InitializeComponent();
        }


        public DispatcherTimer timer;

        void timer_Tick(object sender, EventArgs e)
        {

            Timer1.Text = DateTime.Now.ToString("yyyy-dd-MM HH:mm:ss");
        }



        private void 返回箭头_MouseDown(object sender, MouseButtonEventArgs e)
        {
            NavigationService.Navigate(窗口.主页);
        }

        private void Page_Initialized(object sender, EventArgs e)
        {
            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();
            Storyboard baiyun = Resources["箭头移动"] as Storyboard;
            baiyun.Begin();

         
        }
        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            提示页面 form = new 提示页面("确定要退出程序吗？");
            form.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            form.ShowDialog();
            //   Application.Exit();  //强制所有消息中止，退出所有的窗体，但是若有托管线程（非主线程），也无法干净地退出；  

            // Application.ExitThread(); //强制中止调用线程上的所有消息，同样面临其它线程无法正确退出的问题；  
            if (form.是否)
            {
                form.Close();
                System.Environment.Exit(0);   //这是最彻底的退出方式，不管什么线程都被强制退出，把程序结束的很干净，退出时有可能会抛出异常  
            }
            else
            {
                form.Close();
            }


            //  System.Diagnostics.Process tt = System.Diagnostics.Process.GetProcessById(System.Diagnostics.Process.GetCurrentProcess().Id);
            // tt.Kill();//直接杀死与本程序相关的所有进程，有可能会导致数据丢失，但是不会抛出异常。
        }

        private void 鼠标进入(object sender, MouseEventArgs e)
        {
            Image ig = sender as Image;
            switch (ig.Tag.ToString())
            {

                case "退出":
                    {
                        Uri ur = new Uri("/fap;component/素材/公用/退出.png", UriKind.Relative);
                        BitmapImage bp = new BitmapImage(ur);
                        ig.Source = bp;


                        break;
                    }

            }
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 300);
            WPF相应类.ScaleEasingAnimationShow(ig, 1, 1.1, 2, timeSpan);
        }
        private void 鼠标离开(object sender, MouseEventArgs e)
        {
            Image ig = sender as Image;
            switch (ig.Tag.ToString())
            {

                case "退出":
                    {
                        Uri ur = new Uri("/fap;component/素材/公用/退出.png", UriKind.Relative);
                        BitmapImage bp = new BitmapImage(ur);
                        ig.Source = bp;


                        break;
                    }


            }
            TimeSpan timeSpan = new TimeSpan(0, 0, 0, 0, 300);
            WPF相应类.ScaleEasingAnimationShow(ig, 1.1, 1, 2, timeSpan);
        }

        private void Label_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            切换界面(0);
        }
        public void 切换界面(int x)
        {
            switch (x)
            {
                case 0:
                    {
                        NavigationService.Navigate(窗口.主页);

                        break;
                    }

                case 1:
                    {
                        NavigationService.Navigate(窗口.主页);

                        break;
                    }

                case 3:
                    {
                        NavigationService.Navigate(窗口.运动控制);

                        break;
                    }
                case 4:
                    {
                        NavigationService.Navigate(窗口.统计);

                        break;
                    }
                case 5:
                    {

                        break;
                    }

            }

        }
        private void 起始日期控件_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
         
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

            //主数据.图表item = new ObservableCollection<BarItems>(){ new BarItems() {日期 = "6-19",良率= 100 ,功能不良 = 5,外观不良=35 },
            //    new BarItems() { 日期 = "6-19", 良率 = 99.9,功能不良 = 2,外观不良=55 },
            //    //new BarItems() { Name = "4564562", 良品率 = 1000,Value2 = 900 },
            //    //new BarItems() { Name = "3asdfwer", 良品率 = 1000,Value2 = 900 },
            //    //new BarItems() { Name = "42xxfgsf", 良品率 = 7000,Value2 = 900 },
            //    //new BarItems() { Name = "5", Value1 = 5000,Value2 = 300 },
            //    //new BarItems() { Name = "6!#$$%%%", Value1 = 1000,Value2 = 5000 },
            //    //new BarItems() { Name = "7撒过洒", Value1 = 10020,Value2 = 900 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },
            //    //new BarItems() { Name = "8首发式地方", Value1 = 10500,Value2 = 3000 },

            //};
            //柱状图.ItemsSource = 主数据.图表item;
            //柱状图.RefreshView();
        }

    }



}

